package com.billion.payment.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "payment.weixin")
@PropertySource(value = {"classpath:payment.yml"})
public class WxpayConfig {

    /** 微信公众号或小程序的appid */
    private static String appId;

    /** 微信支付商户号 */
    private static String mchId;

    /** 微信支付商户密钥 */
    private static String mchKey;

    /** 微信支付证书路径 */
    private static String keyPath;

    /** 微信支付回调地址 */
    private static String notifyUrl;

    public static String getAppId() {
        return appId;
    }

    @Value("${appId}")
    public void setAppId(String appId) {
        WxpayConfig.appId = appId;
    }

    public static String getMchId() {
        return mchId;
    }

    @Value("${mchId}")
    public void setMchId(String mchId) {
        WxpayConfig.mchId = mchId;
    }

    public static String getMchKey() {
        return mchKey;
    }

    @Value("${mchKey}")
    public void setMchKey(String mchKey) {
        WxpayConfig.mchKey = mchKey;
    }

    public static String getKeyPath() {
        return keyPath;
    }

    @Value("${keyPath}")
    public void setKeyPath(String keyPath) {
        WxpayConfig.keyPath = keyPath;
    }

    public static String getNotifyUrl() {
        return notifyUrl;
    }

    @Value("${wx_notifyUrl}")
    public void setNotifyUrl(String notifyUrl) {
        WxpayConfig.notifyUrl = notifyUrl;
    }
}
